﻿<%@ Control Language="C#" Inherits="System.Web.Mvc.ViewUserControl<JPageAdd>" %>
<% using (Html.BeginForm(RequestHelper.GetAction(), RequestHelper.GetController(), FormMethod.Post, new { @enctype = "multipart/form-data" }))
   { %>
<style type="text/css">
    .common-text {
    width:435px;
    }
</style>
<div class="crumb-wrap">
    <div class="crumb-list"><i class="icon-font"></i><a href="#">首页</a><span class="crumb-step">&gt;</span><a class="crumb-name" href="#"><%=Model.PageTitle %></a><span class="crumb-step">&gt;</span><span><%=Model.PageSubTitle %></span></div>
</div>
<div class="result-wrap">
    <div class="result-content">
        <table class="insert-tab" width="100%">
            <tbody>
                <%
       bool isAddUploadScritpt = false;
       bool isAddEditorScript = false;
       foreach (var AddItem in Model.AddItems) %>
                <%{ %>
                <tr>
                    <td style="width:150px;">
                        <span>
                            <%= AddItem.Title%>：</span>
                    </td>
                    <td>
                        <%if (AddItem.cType == JAddItem.EnumcType.uploadify)
                          {
                              isAddUploadScritpt = true;
                              if (!Model.IsViewMode)
                              {
                                  Html.RenderPartial("UploadControl", new UploadModel { Path = AddItem.cValue.J_ToString(), HiddenName = AddItem.cName, Config = AddItem.UploadConfig });
                              }
                              else
                              {
                                  Response.Write("<img src='{0}' />".J_Format(AddItem.cValue.J_ToString()));
                              }
                          }
                          else
                          {
                              if (!isAddEditorScript)
                              {
                                  isAddEditorScript = AddItem.cType == JAddItem.EnumcType.Editor;
                              }
                        %>
                        <%= AddItem.ControlHtml(Model.IsViewMode)%>
                        <%} %>
                        <span class="<%=AddItem.cName %>_tips"><%=AddItem.Tips %></span>
                    </td>
                </tr>
                <%} %>
                <tr>
                    <td colspan="2">
                        <%: Html.ValidationSummary(true, "提交不成功,请更正错误并重试:")%>
                    </td>
                </tr>
                <tr>
                    <th></th>
                    <td>
                        <input type="submit" value="储存" id="submit1" class="btn btn-primary btn6 mr10" style="display: <%=Model.SaveBtnDisplay%>" />
                        <input type="button" value="返回" id="btnReturn" class="btn btn6" style="display: <%=Model.RtBtnDisplay%>" />
                    </td>
                </tr>
            </tbody>
        </table>
    </div>
</div>
<!---添加上传脚本-->
<%if (isAddUploadScritpt)
  { %>
<!--#Include File="~/Header/HeadUploadJs.aspx"-->
<%} %>

<script>
    $(function () {
        $("#btnReturn").click(function () {
            document.location = "<%= Model.PageReturnLink%>";
        })
    })
</script>
<script type="text/javascript">
    $(function () {
        $("input[type='checkbox']").click(function () {
            if ($(this).attr("checked")==true) {
                this.value = "Y";
            } else {
                this.value = "N";
            }

        });
    });
</script>
<%= TempData["PageJS"]%>
<%} %>
